<?php

namespace App\Modules\Admin\Http\Controllers\Water;

use App\Http\Controllers\Controller;
use App\Modules\Admin\Http\Controllers\BaseController;
use App\Modules\Admin\Services\Water\Statistic\StatisticService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class StatisticController extends BaseController
{

    public function __construct(StatisticService $service)
    {
        $this->service = $service;
    }
    /**
     * @param StatisticService $statisticService
     * @return mixed
     */

    public function apparatus(Request $request) : JsonResponse
    {
        $result = $this->service->getSelectListApparatus($request);
        if ($result){
            return $this->successJson($result, $this->service->getError());
        }else{
            return $this->errorJson($this->service->getError());
        }
    }

    /**
     * @param StatisticService $statisticService
     * @return mixed
     */
    public function scores(Request $request) : JsonResponse
    {
        $result = $this->service->getSelectListScores($request);
        if ($result){
            return $this->successJson($result, $this->service->getError());
        }else{
            return $this->errorJson($this->service->getError());
        }
    }
    /**
     * @param StatisticService $statisticService
     * @return mixed
     */
    public function allScores(Request $request) : JsonResponse
    {
        $result = $this->service->getSelectListSallScores($request);
        if ($result){
            return $this->successJson($result, $this->service->getError());
        }else{
            return $this->errorJson($this->service->getError());
        }

    }

    /**
     * @param StatisticService $statisticService
     * @return mixed
     */

    public function propertyFee(Request $request): JsonResponse
    {
        $result = $this->service->getSelectListsPropertyFee($request);
        if ($result){
            return $this->successJson($result, $this->service->getError());
        }else{
            return $this->errorJson($this->service->getError());
        }
    }
}
